/*
 * @Author: Wyvonj 
 * @Date: 2018-04-19 16:47:44 
 * @Last Modified by: Wyvonj
 * @Last Modified time: 2018-04-20 14:48:03
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuex from 'vuex'
import Cookie from 'js-cookie'
import Vuetify from 'vuetify'

import {
  router
} from './router'
// import store from './store'

import 'vuetify/dist/vuetify.min.css'
import './style/custom.less'
import _ from 'lodash'

import Root from './pages/Root.vue'

window.Cookie = Cookie
window._ = _

Vue.use(Vuex)
Vue.use(VueRouter)
Vue.use(Vuetify, {
  theme: {
    primary: '#009688',
    secondary: '#b0bec5',
    accent: '#4db6ac',
    error: '#b71c1c',
    light: '#f1f1f1'
  }
})

// 权限指令
Vue.directive('has', {
  bind: function(el, binding) {
    if (!Vue.prototype.$_has(binding.value)) {
      Vue.nextTick(() => {
        el.parentNode.removeChild(el)
      })
    }
  }
})

const heroType = {
  '1': '坦克',
  '2': '战士',
  '3': '刺客',
  '4': '法师',
  '5': '射手',
  '6': '辅助',
};


const EquipType = {
  '1': '攻击',
  '2': '法术',
  '3': '防御',
  '4': '移动',
  '5': '打野',
  '6': '辅助'
}

const InsType = {
  '1': '蓝',
  '2': '绿',
  '3': '红',
}
window.EquipType = EquipType;
window.InsType = InsType;

Vue.filter('HeroType', (value) => {
  return heroType[value]
});

// 装备类型
Vue.filter('EquipType', (value) => {
  return EquipType[value]
})
// 装备类型
Vue.filter('InsType', (value) => {
  return InsType[value]
})

document.addEventListener('DOMContentLoaded', () => {
  const $Vue = new Vue({
    router,
    // store, // 注入到所有子组件
    components: {
      Root
    }
  })
  // $Vue.$mount('#root')
  router.onReady(() => {
    $Vue.$mount('#root')
  })
  window.$Vue = $Vue
})